package ut.com.gitee.booting.idem4j;

import org.junit.Assert;
import org.junit.Test;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class UTPattern {

    @Test
    public void UT_camel_replace() {
        final Pattern camel = Pattern.compile("-(.)");
        StringBuffer result = new StringBuffer();
        Matcher m = camel.matcher("hello-world-h-r-you");
        while (m.find()) {
            m.appendReplacement(result, m.group(1).toUpperCase());
        }
        m.appendTail(result);
        Assert.assertEquals(result.toString(), "helloWorldHRYou");
    }
}
